var ECommand = {None:"None", Edit: "Edit", New: "New", View: "View", Delete: "Delete", Filter:"Filter" };

var site = (function () {
    var container = null;
    function init(){
    }	
    function initEvents(){
    }
	$domready(init);

})();
function QSParser(key, name){
	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
    var regexS = "[\\?&]" + key + "=([^&#]*)";  
	var regex = new RegExp( regexS );  
    var results = regex.exec( name );  
	if( results == null ){
	    return "";  
	}
	 else{
	    return results[1];
	}
}

function getRandomString() {
    var s=[];
    var a='a'.charCodeAt();
    var z='z'.charCodeAt();
    
    (7).times(function () {
        s.push(String.fromCharCode(Math.floor(Math.random()*(z-a))+a));
    });
    return s.join("");
}
function getRandomNumber(length) {
    return Math.floor(Math.random() * length)
}
function formsTest(){
    var elements = $$("input[type='text'], select, textarea");
    elements.each(function (inp) {
        switch(inp.get("name")) {
            case "idnumber":
                inp.set("value",getRandomNumber(10000001)); 
                break;
            case "numberofchildren":case "apartment":
                inp.set("value",getRandomNumber(11)); 
                break;
            case "housenumber":
                inp.set("value","22"); 
                break;
            case "zip":
                inp.set("value",getRandomNumber(109001)); 
                break;
            case "email":
                inp.set("value","imlarrybs@gmail.com"); 
                break;
            case "sex": inp.selectedIndex=0; break;
            case null: break;
            default: inp.set("value",getRandomString());
        }
    });
}
